import { IPSApplication } from '../../app/ipsapplication';
import { IPSAppCounter } from '../../app/control/ipsapp-counter';
import { IPSAppDEMethod } from '../../app/dataentity/ipsapp-demethod';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSAppWF } from '../../app/wf/ipsapp-wf';
import { IPSAppWFUIAction } from '../../app/wf/ipsapp-wfuiaction';
import { IPSAppWFVer } from '../../app/wf/ipsapp-wfver';
import { IPSNavigateContext } from '../../control/ipsnavigate-context';
import { IPSNavigateParam } from '../../control/ipsnavigate-param';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { IPSUIAction } from '../../view/ipsuiaction';
import { IPSWorkflow } from '../ipsworkflow';
import { IPSWFUIAction } from './ipswfuiaction';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSWFUIActionImpl extends PSModelObjectImpl implements IPSWFUIAction, IPSAppWFUIAction {
  get actionLevel(): 50 | 100 | 200 | 250 {
    return this.M.actionLevel != null ? this.M.actionLevel : 100;
  }

  get actionTarget(): 'SINGLEDATA' | 'SINGLEKEY' | 'MULTIDATA' | 'MULTIKEY' | 'NONE' {
    return this.M.actionTarget;
  }

  protected cmpslanguageres: IPSLanguageRes | null = null;

  getCMPSLanguageRes(): IPSLanguageRes | null {
    if (this.cmpslanguageres != null) return this.cmpslanguageres;
    const value = this.M.getCMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cmpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCMPSLanguageRes') as IPSLanguageRes;
    return this.cmpslanguageres;
  }

  get cMPSLanguageRes(): IPSLanguageRes | null {
    return this.getCMPSLanguageRes();
  }

  getCMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定确认信息语言资源');
    }
    return value;
  }

  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get confirmMsg(): string {
    return this.M.confirmMsg;
  }

  get contextJOString(): string {
    return this.M.contextJOString;
  }

  get counterId(): string {
    return this.M.counterId;
  }

  get dataAccessAction(): string {
    return this.M.dataAccessAction;
  }

  get dialogResult(): 'OK' | 'CANCEL' | 'YES' | 'NO' {
    return this.M.dialogResult;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected frontpsappview: IPSAppView | null = null;

  getFrontPSAppView(): IPSAppView | null {
    if (this.frontpsappview != null) return this.frontpsappview;
    const value = this.M.getFrontPSAppView;
    if (value == null) {
      return null;
    }
    this.frontpsappview = this.getPSModel4('app.view.IPSAppView', value, 'getFrontPSAppView') as IPSAppView;
    return this.frontpsappview;
  }

  get frontPSAppView(): IPSAppView | null {
    return this.getFrontPSAppView();
  }

  getFrontPSAppViewMust(): IPSAppView {
    const value = this.getFrontPSAppView();
    if (value == null) {
      throw new Error('未指定前端应用视图');
    }
    return value;
  }

  get frontProcessType(): 'WIZARD' | 'TOP' | 'PRINT' | 'DATAIMP' | 'DATAEXP' | 'OPENHTMLPAGE' | 'OTHER' {
    return this.M.frontProcessType;
  }

  get fullCodeName(): string {
    return this.M.fullCodeName;
  }

  get htmlPageUrl(): string {
    return this.M.htmlPageUrl;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected nextpsuiaction: IPSUIAction | null = null;

  getNextPSUIAction(): IPSUIAction | null {
    if (this.nextpsuiaction != null) return this.nextpsuiaction;
    const value = this.M.getNextPSUIAction;
    if (value == null) {
      return null;
    }
    this.nextpsuiaction = this.getPSModel4('view.IPSUIAction', value, 'getNextPSUIAction') as IPSUIAction;
    return this.nextpsuiaction;
  }

  get nextPSUIAction(): IPSUIAction | null {
    return this.getNextPSUIAction();
  }

  getNextPSUIActionMust(): IPSUIAction {
    const value = this.getNextPSUIAction();
    if (value == null) {
      throw new Error('未指定下一步界面行为');
    }
    return value;
  }

  protected psappcounter: IPSAppCounter | null = null;

  getPSAppCounter(): IPSAppCounter | null {
    if (this.psappcounter != null) return this.psappcounter;
    const value = this.M.getPSAppCounter;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.psappcounter = ipsapplication.findPSAppCounter(value);
    }
    return this.psappcounter;
  }

  get psAppCounter(): IPSAppCounter | null {
    return this.getPSAppCounter();
  }

  getPSAppCounterMust(): IPSAppCounter {
    const value = this.getPSAppCounter();
    if (value == null) {
      throw new Error('未指定应用计数器');
    }
    return value;
  }

  protected psappdemethod: IPSAppDEMethod | null = null;

  getPSAppDEMethod(): IPSAppDEMethod | null {
    if (this.psappdemethod != null) return this.psappdemethod;
    const value = this.M.getPSAppDEMethod;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdemethod = ipsappdataentity.findPSAppDEMethod(value);
    }
    return this.psappdemethod;
  }

  get psAppDEMethod(): IPSAppDEMethod | null {
    return this.getPSAppDEMethod();
  }

  getPSAppDEMethodMust(): IPSAppDEMethod {
    const value = this.getPSAppDEMethod();
    if (value == null) {
      throw new Error('未指定应用实体方法');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.psappdataentity = ipsapplication.findPSAppDataEntity(value);
    }
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected psappwf: IPSAppWF | null = null;

  getPSAppWF(): IPSAppWF | null {
    if (this.psappwf != null) return this.psappwf;
    const value = this.M.getPSAppWF;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.psappwf = ipsapplication.findPSAppWF(value);
    }
    return this.psappwf;
  }

  get psAppWF(): IPSAppWF | null {
    return this.getPSAppWF();
  }

  getPSAppWFMust(): IPSAppWF {
    const value = this.getPSAppWF();
    if (value == null) {
      throw new Error('未指定应用工作流');
    }
    return value;
  }

  protected psappwfver: IPSAppWFVer | null = null;

  getPSAppWFVer(): IPSAppWFVer | null {
    if (this.psappwfver != null) return this.psappwfver;
    const value = this.M.getPSAppWFVer;
    if (value == null) {
      return null;
    }
    const ipsappwf = this.getPSAppWF();
    if (ipsappwf != null) {
      this.psappwfver = ipsappwf.findPSAppWFVer(value);
    }
    return this.psappwfver;
  }

  get psAppWFVer(): IPSAppWFVer | null {
    return this.getPSAppWFVer();
  }

  getPSAppWFVerMust(): IPSAppWFVer {
    const value = this.getPSAppWFVer();
    if (value == null) {
      throw new Error('未指定应用工作流版本');
    }
    return value;
  }

  protected psnavigatecontexts: IPSNavigateContext[] | null = null;

  getPSNavigateContexts(): IPSNavigateContext[] | null {
    if (this.psnavigatecontexts == null) {
      this.psnavigatecontexts = this.fillChildListModel(this.M.getPSNavigateContexts, 'control.IPSNavigateContext') as IPSNavigateContext[];
    }
    return this.psnavigatecontexts;
  }

  get psNavigateContexts(): IPSNavigateContext[] | null {
    return this.getPSNavigateContexts();
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5('control.IPSNavigateContext', this.getPSNavigateContexts(), objKey) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[] | null = null;

  getPSNavigateParams(): IPSNavigateParam[] | null {
    if (this.psnavigateparams == null) {
      this.psnavigateparams = this.fillChildListModel(this.M.getPSNavigateParams, 'control.IPSNavigateParam') as IPSNavigateParam[];
    }
    return this.psnavigateparams;
  }

  get psNavigateParams(): IPSNavigateParam[] | null {
    return this.getPSNavigateParams();
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5('control.IPSNavigateParam', this.getPSNavigateParams(), objKey) as IPSNavigateParam;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定界面行为图标对象');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  protected psworkflow: IPSWorkflow | null = null;

  getPSWorkflow(): IPSWorkflow | null {
    if (this.psworkflow != null) return this.psworkflow;
    const value = this.M.getPSWorkflow;
    if (value == null) {
      return null;
    }
    this.psworkflow = this.getPSModel4('wf.IPSWorkflow', value, 'getPSWorkflow') as IPSWorkflow;
    return this.psworkflow;
  }

  get psWorkflow(): IPSWorkflow | null {
    return this.getPSWorkflow();
  }

  getPSWorkflowMust(): IPSWorkflow {
    const value = this.getPSWorkflow();
    if (value == null) {
      throw new Error('[getPSWorkflow]返回空值');
    }
    return value;
  }

  get paramItem(): string {
    return this.M.paramItem;
  }

  get predefinedType(): string {
    return this.M.predefinedType;
  }

  get refreshMode(): 0 | 1 | 2 | 3 {
    return this.M.refreshMode != null ? this.M.refreshMode : 0;
  }

  protected smpslanguageres: IPSLanguageRes | null = null;

  getSMPSLanguageRes(): IPSLanguageRes | null {
    if (this.smpslanguageres != null) return this.smpslanguageres;
    const value = this.M.getSMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.smpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getSMPSLanguageRes') as IPSLanguageRes;
    return this.smpslanguageres;
  }

  get sMPSLanguageRes(): IPSLanguageRes | null {
    return this.getSMPSLanguageRes();
  }

  getSMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getSMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定成功信息语言资源');
    }
    return value;
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get successMsg(): string {
    return this.M.successMsg;
  }

  get textItem(): string {
    return this.M.textItem;
  }

  get timeout(): number {
    return this.M.timeout;
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  protected tooltippslanguageres: IPSLanguageRes | null = null;

  getTooltipPSLanguageRes(): IPSLanguageRes | null {
    if (this.tooltippslanguageres != null) return this.tooltippslanguageres;
    const value = this.M.getTooltipPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.tooltippslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getTooltipPSLanguageRes') as IPSLanguageRes;
    return this.tooltippslanguageres;
  }

  get tooltipPSLanguageRes(): IPSLanguageRes | null {
    return this.getTooltipPSLanguageRes();
  }

  getTooltipPSLanguageResMust(): IPSLanguageRes {
    const value = this.getTooltipPSLanguageRes();
    if (value == null) {
      throw new Error('未指定操作提示语言资源');
    }
    return value;
  }

  get uIActionMode(): 'SYS' | 'FRONT' | 'BACKEND' | 'WFFRONT' | 'WFBACKEND' | 'CUSTOM' {
    return this.M.uIActionMode;
  }

  get uIActionParamJO(): IModel {
    return this.M.uIActionParamJO;
  }

  get uIActionTag(): string {
    return this.M.uIActionTag;
  }

  get uIActionType(): string {
    return this.M.uIActionType;
  }

  get uILogicAttachMode(): 'REPLACE' | 'AFTER' {
    return this.M.uILogicAttachMode;
  }

  get uILogicType(): string {
    return this.M.uILogicType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueItem(): string {
    return this.M.valueItem;
  }

  get closeEditView(): boolean {
    return this.M.closeEditView;
  }

  get closePopupView(): boolean {
    return this.M.closePopupView;
  }

  get enableConfirm(): boolean {
    return this.M.enableConfirm;
  }

  get enableRuntimeModel(): boolean {
    return this.M.enableRuntimeModel;
  }

  get enableToggleMode(): boolean {
    return this.M.enableToggleMode;
  }

  get group(): boolean {
    return this.M.group;
  }

  get reloadData(): boolean {
    return this.M.reloadData;
  }

  get saveTargetFirst(): boolean {
    return this.M.saveTargetFirst != null ? this.M.saveTargetFirst : false;
  }

  get showBusyIndicator(): boolean {
    return this.M.showBusyIndicator != null ? this.M.showBusyIndicator : true;
  }

  get cls(): string {
    return 'PSWFUIActionImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.IPSApplicationObject' || cls == 'app.view.IPSAppUIAction' || cls == 'app.wf.IPSAppWFUIAction' || cls == 'wf.IPSWorkflowObject' || cls == 'wf.uiaction.IPSWFUIAction') return true;
    return super.instanceof(cls);
  }
}
